package ar.uba.fi.taller2.ftrs.tree;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

import ar.uba.fi.taller2.ftrs.common.Parameters;
import ar.uba.fi.taller2.ftrs.repo.RepositoryManager;
/**
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2004</p>
 * <p>Company: </p>
 * @author sebastian rivas
 * @version 1.0
 */

public class Main {

  public static void main(String args[]) throws Exception {
	//System.out.println(Parameters.getParametros().getMessage("MSG",2));
    ArrayList tmp = new ArrayList();
    BSTree btree = BSTree.getBPTree();
  /*  Random generator = new Random();
    btree.addKey("10",new Integer(10), -1);
   btree.addKey("9",new Integer(9), -1);
    btree.addKey("8",new Integer(8), -1);
    btree.addKey("7",new Integer(7), -1);
    btree.addKey("3",new Integer(333), -1);
    btree.addKey("94",new Integer(94), -1);
    btree.addKey("90",new Integer(90), -1);
   btree.addKey("113",new Integer(113), -1);
    

  while(btree.size()<1000){
      Integer next = new Integer(generator.nextInt(200));
      if(!btree.containsKey(next)){
        btree.put((new Integer(btree.size())).toString(), btree.size());
        tmp.add(next);

      }
    }

   // btree.printKeys();
    Collections.sort(tmp,null);*/
    //System.out.println(tmp.toString());
   // btree.Print();
    

   
   // btree.printXML("c:\\seba.xml");
  //  btree.printXML();
    //FileManager.write(btree);
   // Integer in=btree.hashCode();
   // BSTree n ;//= new BSLeafNode(null,1);
    
    //n.get("Que");
  //  int hash=n.hashCode();
  //  n=null;
  //  n=FileManager.readBSTree(0)  ; 
    
   btree.printXML();

    
    System.out.println(btree.getValue("alberto"));
   // FileManager.write(btree);
  //  FileManager.readBSTree(0)  ; 
    try {
		btree.finalize();
	} catch (Throwable e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

  }



}
